<?php
/**
 * All representations of Default Config's Values are defined by the class in this file
 *
 * @category	Configuration
 * @package		dayscript.config
 * @subpackage
 * @author		Nelson Daza <ndaza@dayscript.com>
 * @copyright	2009 Dayscript Ltda.
 * @license
 * @version		1.0
 * @version		$Revision: 0 $
 * @filesource
 * @link		http://www.dayscript.com
 * @link		{docsLink}
 * @uses
 * @since		1.0
 * @modifiedby	$LastChangedBy: Nelson Daza $
 * @modified	$Date: 2009-08-21 $
 */

namespace dayscript\config;

/**
 * Application's defaults config values
 *
 * Used to generate minimum config values for applications.
 *
 * @category	Configuration
 * @package		dayscript.config
 * @subpackage
 * @author		Nelson Daza <ndaza@dayscript.com>
 * @copyright	2009 Dayscript Ltda.
 * @license
 * @version		1.0
 * @link		http://www.dayscript.com
 * @link		{docsLink}
 * @uses		\dayscript\Map
 * @since		1.0
 * @see			\dayscript\Map
 * @modifiedby	$LastChangedBy: Nelson Daza $
 * @modified	$Date: 2009-08-26 $
 */
class ApplicationDefaults extends \dayscript\Map	{
	/**
	 * Constructs a new ApplicationDefaults.
	 *
	 * @return ApplicationDefaults
	 */
	public function __construct( )	{
		parent::__construct( );
		$this->createDefaultValues( );
	}
	/**
	 * Filling out the default values for config files
	 */
	protected function createDefaultValues( )	{
		$this->clear( );
		/**
		 * HOST to your application, WITHOUT protocol and WITHOUT a trailing slash or AUTO for an automatic detection.
		 * [subdomain(s).]domain.[SLD.]TLD, WITHOUT "://" or AUTO for an automatic detection.
		 * E.g.: 'video.google.co.uk' | 'www.example.com'
		 */
		$this['HOST'] = 'AUTO';
		
		/**
		 * PROTOCOL that will use your application or AUTO for an automatic detection.
		 */
		$this['PROTOCOL'] = 'AUTO';
		
		/**
		 * PORT that will use your application or you can leave it empty when using de default port of your "web server".
		 * (Use 80 to force URLs to include it.)
		 */
		$this['PORT'] = '';
		
		/**
		 * Location to your application on the web server, WITH a trailing slash.
		 * E.g.: /myApp/
		 */
		$this['PATH'] = '';
		
		/**
		 * Location of your application on the server, WITH a trailing slash.
		 * E.g.: /var/www/html/myApp/ c:\\wwwroot\\myApp
		 */
		$this['DIR'] = '';
		
		/**
		 * Index File, Typically this will be your index.php file, unless you've renamed it to something else.
		 * If you are using mod_rewrite to remove the page leave this empty.
		 */
		$this['INDEX_PAGE'] = 'index.php';
		
		/**
		 * Allowed URL Characters.
		 * This lets you specify with a regular expression which characters are permitted within your URLs.
		 * When someone tries to submit a URL with disallowed characters they will get a warning message.
		 *
		 * As a security measure you are STRONGLY encouraged to restrict URLs to as few characters as possible.
		 * By default only these are allowed: a-z 0-9~%.:_-
		 *
		 * Leave blank to allow all characters -- but only if you are insane.
		 * DO NOT CHANGE THIS UNLESS YOU FULLY UNDERSTAND THE REPERCUSSIONS!!
		 *
		 * TODO
		 */
		$this['URI_CHARS'] = 'a-z 0-9~%.:_\-';
		
		/**
		 * Default Character Set.
		 * TODO
		 */
		$this['CHARSET'] = 'UTF-8';
		
		/**
		 * QUERY STRING TYPE comes from FriendlyLink type and adds search-engine segments.
		 * TODO
		 */
		$this['QUERY_STRING_TYPE'] = '';
		
		/**
		 * PHP settings we want to initialize.
		 * You can initialize php's settings using this method that will call ini_set( ['PHP'][$key], ['PHP'][$value] ).
		 */
		$this['PHP'] = new \dayscript\Map( );
		$this['PHP']['display_errors'] = 0;
		$this['PHP']['display_startup_errors'] = 0;
		$this['PHP']['log_errors'] = 0;
		$this['PHP']['ignore_repeated_errors'] = 1;
		$this['PHP']['track_errors'] = 0;
		$this['PHP']['html_errors'] = 0;
		$this['PHP']['register_globals'] = 0;
		$this['PHP']['register_long_arrays'] = 0;
		$this['PHP']['register_argc_argv'] = 0;
		$this['PHP']['magic_quotes_gpc'] = 0;
		$this['PHP']['magic_quotes_runtime'] = 0;
		$this['PHP']['magic_quotes_sybase'] = 0;
		$this['PHP']['default_mimetype'] = 'text/html';
		$this['PHP']['default_charset'] = $this['CHARSET'];
		$this['PHP']['scream.enabled'] = 0;
		$this['PHP']['file_uploads'] = 1;
		$this['PHP']['date.timezone'] = 'America/Bogota';
		$this['PHP']['zend_extension'] = '';
		
		/**
		 * SESSION settings.
		 * This will override php settings.
		 */
		$this['SESSION'] = new \dayscript\Map( );
		$this['SESSION']['name'] = 'DAYSESSID';
		$this['SESSION']['lifetime'] = 604800;
		$this['SESSION']['path'] = '';
		$this['SESSION']['domain'] = '';
		$this['SESSION']['handler'] = '';
		$this['SESSION_HANDLER'] = null;
		
		/**
		 * Log configuration index.
		 */
		$this['LOG'] = new \dayscript\Map( );
		
		/**
		 * You can determine what php's information gets logged using global php constants like ( E_ALL | E_STRICT ), a binary string representation or an integer; use 0(int) or '0' for no Logging.
		 * <code>
		 * $this['LOG']['PHP_THRESHOLD'] = ( E_ALL | E_STRICT );
		 * </code>
		 */
		$this['LOG']['PHP_THRESHOLD'] = 0;
		
		/**
		 * You can determine what application's/framework's information gets logged using a binary, a binary string or an integer.
		 * '0000000' = No logging
		 * '0000001' = Warnings, Deprecation
		 * '0000010' = Notices, Information
		 * '0000100' = Error, Exception
		 * '0001000' = Especial user defined Information
		 * '0010000' = Datasource requests
		 * '0100000' = Object's actions
		 * '1000000' = Bechmark report
		 *
		 * Example:
		 * <code>
		 * $this['LOG']['APP_THRESHOLD'] = b'1111111';
		 * </code>
		 */
		$this['LOG']['APP_THRESHOLD'] = 0;
		
		/**
		 * You can determine where the information gets logged using a binary, a binary string or an integer.
		 * '0000000' = No Log.
		 * '0000001' = Log info in the exact moment that it comes.
		 * '0000010' = Store the log info right before the script execution ends.
		 *
		 * Example:
		 * <code>
		 * $this['LOG']['TYPE'] = b'000010'; // Log after ends
		 * </code>
		 */
		$this['LOG']['TYPE'] = b'0000001';
		/**
		 * Logs Date Format, You can use PHP date codes to set your own date formatting.
		 */
		$this['LOG']['DATE'] = 'Y-m-d H:i:s.u';
		/**
		 * Loggers.
		 *
		 * Each and every logger added in this config will be added as soon as the
		 * application starts and during all script execution.
		 *
		 * [_alias_][...]	Unique alias for each logger
		 *
		 * Required values for every logger
		 * ['logger']				string			Class name like '\dayscript\log\Logger'
		 * ['php_threshold']		int/binary		Filter for PHP information to log. Default -1 (All)
		 * ['app_threshold']		int/binary		Filter for APP information to log. Default -1 (All)
		 * ['prepend']				string			Prepend to every each log message. Default "'[' . date( 'Y-m-d H:i:s' ) . '] '", used as an eval expresion.
		 * ['append']				string			Append to every each log message. Default '', used as an eval expresion.
		 *
		 * Other values upon each and every logger
		 * Examples:
		 * <code>
		 * $this['LOGGERS']['files']				= new \dayscript\Map( );
		 * $this['LOGGERS']['files']['logger']		= '\\dayscript\\log\\adapter\\File';
		 * $this['LOGGERS']['files']['file']		= '/where/to/store/files/' . date( 'Y-m-d H' ) . 'H.txt';
		 *
		 * $this['LOGGERS']['output']				= new \dayscript\Map( );
		 * $this['LOGGERS']['output']['logger']		= '\\dayscript\\log\\adapter\\Output';
		 * </code>
		 */
		$this['LOGGERS'] = new \dayscript\Map( );
		/**
		 * Cache configuration index.
		 * TODO
		 */
		$this['CACHE'] = new \dayscript\Map( );
		
		/**
		 * Cache Directory Path, You can determine where the information gets logged.
		 * Use a full server path with trailing slash.
		 * TODO
		 */
		$this['CACHE']['PATH'] = '';
		
		/**
		 * Global XSS Filtering.
		 * Determines whether the XSS filter is always active when GET, POST or COOKIE data is encountered
		 * TODO
		 */
		$this['XSS_FILTER'] = FALSE;
		
		/**
		 * Time Reference.
		 * Options are "local" or "gmt". This pref tells the system whether to use your server's local time as the master "now" reference,
		 * or convert it to GMT
		 * TODO
		 */
		$this['TIME_REFERENCE'] = 'local';
		
		/**
		 * Modules.
		 * TODO
		 */
		$this['MODULES'] = new \dayscript\Map( );
		
		/**
		 * Modules aliases.
		 *
		 * Each and every module added in this config will be instanced as soon as the application is initialized.
		 * Commonly, each module will register its own class loader, verify its dependencies, register its eventDispatchers ... in its init() method.
		 *
		 * [_alias_][...]		Unique alias for each module
		 *
		 * Required values for every module
		 * [_alias_]['active']		true/false		Whether to use this module
		 * [_alias_]['class']		string			'className';	// \name\space\class that implements \dayscript\application\Module
		 * [_alias_]['file']		string			'pathToFile';	// /path/to/class/folder/XX.class.php, default: Enviromente::dir( ). 'modules/[_alias_]/classes/[_alias_]['class'].class.php'
		 * [_alias_]['event']		string|array	'applicationEventType';	// Only when no class defined
		 * TODO
		 */
		//$this['MODULES']['main'] = new \dayscript\Map( );
		/**
		 * Data sources.
		 */
		$this['DATA_SOURCES'] = new \dayscript\Map( );
		/**
		 * Data sources aliases.
		 *
		 * Each and every datasource added in this config will be initialized as soon as the application call it for the first time,
		 * but won't be opened.
		 *
		 * [_alias_][...]		Unique alias for each datasource
		 *
		 * Required values for every datasource
		 * ['datasource']		\dayscript\datasource\DataSource Class name // In some cases you'll need a module load before you can intanciate a certain class.
		 * ['cache']			TRUE/FALSE - Enables/disables request caching
		 * ['charset']			The character set used in communicating with the datasource
		 *
		 * Other values upon each and every datasource
		 * Example of other values required for 'Database'
		 * ['host']				The hostname of your database server.
		 * ['port'] 			The port of your database server a long int value.
		 * ['protocol']			The protocol of your database server connection.
		 * ['username'] 		The username used to connect to the database
		 * ['password'] 		The password used to connect to the database
		 * ['database'] 		The name of the database you want to connect to
		 * ['schema']			!
		 * ['driver']			The database type. Currently supported: ADO_DB
		 * 						mysql, mysqli, postgre, odbc, mssql, sqlite, oci8
		 * ['persistent']		TRUE/FALSE - Whether to use a persistent connection
		 * ['collation']		The character collation used in communicating with the database.
		 *
		 * Example:
		 * <code>
		 * $this['DATA_SOURCES'] = new \dayscript\Map( );
		 * $this['DATA_SOURCES']['default'] = new \dayscript\Map( );
		 * $this['DATA_SOURCES']['default']['datasource']	= 'dayscript\\datasource\\sql\\MySQLi';
		 * $this['DATA_SOURCES']['default']['cache']		= true;
		 * $this['DATA_SOURCES']['default']['charset']		= 'utf8';
		 * $this['DATA_SOURCES']['default']['host']			= 'localhost';
		 * $this['DATA_SOURCES']['default']['port']			= 0;
		 * $this['DATA_SOURCES']['default']['protocol']		= '';
		 * $this['DATA_SOURCES']['default']['username']		= 'root';
		 * $this['DATA_SOURCES']['default']['password']		= '';
		 * $this['DATA_SOURCES']['default']['database']		= 'test';
		 * $this['DATA_SOURCES']['default']['schema']		= '';
		 * $this['DATA_SOURCES']['default']['options']		= new \dayscript\Map( );
		 * $this['DATA_SOURCES']['default']['persistent']	= false;
		 * $this['DATA_SOURCES']['default']['collation']	= 'utf8_general_ci';
		 * </code>
		 */
		$this['DATA_SOURCES']['default'] = new \dayscript\Map( );
		/**
		 * Default data sources.
		 */
		$this['DATA_SOURCE'] = 'default';
		
	}
}
